using System.Data.Entity.ModelConfiguration;
using Nop.Core.Domain.ShareBuy;

namespace Nop.Data.Mapping.ShareBuy
{
    public partial class ShareBuyItemMap : EntityTypeConfiguration<ShareBuyItem>
    {
        public ShareBuyItemMap ()
        {
            this.ToTable("ShareBuy");
            this.HasKey(bp => bp.Id);

            this.Property(bp => bp.Title).IsRequired().IsMaxLength();
            this.Property(bp => bp.Description).IsRequired().IsMaxLength();

            this.HasRequired(bp => bp.Customer)
                .WithMany()
                .HasForeignKey(bp => bp.CustomerId);
            this.HasRequired(bp => bp.Product)
                .WithMany()
                .HasForeignKey(bp => bp.ProductId);
            this.HasRequired(bp => bp.Order)
                .WithMany()
                .HasForeignKey(bp => bp.OrderId);
        }
    }
}